package com.unitechs.commons.constants;

import lombok.Getter;

@Getter
public enum ZyucExcelOperatorEnum {

    //运算类
    ADD("+"),
    SUBTRACT("-"),
    MULTIPLY("*"),
    DIVIDE("/"),
    REPLACE("replace"),
    REPLACE_SPLIT("%to%"),
    //比较类
    GREATER_THAN(">"),
    LESS_THAN("<"),
    GREATER_THAN_OR_EQUAL_TO(">="),
    LESS_THAN_OR_EQUAL_TO("<="),
    EQUALS("=="),
    NOT_EQUALS("!="),
    CONTAINS("contains"),
    BETWEEN("between"),
    BETWEEN_SPLIT("%and%"),
    PATTERN("pattern"),//暂无
    AND("&&"),//暂无
    OR("||"),//暂无
    NOT("!");//暂无

    private final String code;

    ZyucExcelOperatorEnum(String code) {
        this.code = code;
    }

    public static ZyucExcelOperatorEnum getOperatorEnum(String operatorStr) {
        for (ZyucExcelOperatorEnum operator : ZyucExcelOperatorEnum.values()) {
            if (operator.code.equals(operatorStr)) {
                return operator;
            }
        }
        // 处理未匹配的情况，可以返回默认值或抛出异常
        return null;
    }
}
